import { graphql } from "../graphql";
import type { RegisterFn, RegisterSendVcodeFn } from "./register.types";

export const registerSendVcode: RegisterSendVcodeFn = async (input) => {
  const query = `
    mutation RegisterSendVcode($input: RegisterSendVcodeInput!) {
      registerSendVcode(input: $input)
    }
  `;
  const data = await graphql(query, { input });
  return data.registerSendVcode as string;
};

export const register: RegisterFn = async (input) => {
  const query = `
    mutation Register($input: RegisterInput!) {
      register(input: $input)
    }
  `;
  await graphql(query, { input });
};
